package top.shiyiri.community.dao;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import top.shiyiri.community.bean.LoginTicket;

/**
 * @author Aunean
 * @date 2022/3/14 17:28
 */
@Deprecated
@Repository
public interface LoginTicketMapper {

    @Insert("insert into login_ticket(user_id,ticket,status,expired) values(#{userId},#{ticket},#{status},#{expired})")
    @Options(useGeneratedKeys = true, keyProperty = "id")  //主键自增
    int insertLoginTicket(LoginTicket login);

    @Select("select id,user_id as userId,ticket,status,expired from login_ticket where ticket = #{ticket}")
    LoginTicket selectByTicket(@Param("ticket") String ticket);

    @Update("update login_ticket set status = #{status} where ticket = #{ticket}")
    int updateStatus(@Param("ticket") String ticket, @Param("status") int status);
}
